import { request } from '@/api/REQ'

const modulePrefix  = '/indicator'

// 获取方案详细指标
export function solutionIndicators(solution_id: number) {
	return request({
		url: modulePrefix + `/${solution_id}`,
		method: 'get',
	})
}

// 修改方案详细指标
export function addIndicator(
	solution_id: number,
	indicator_mark: string,
	indicator_name: string
) {
	return request({
		url: modulePrefix + `/addIndicator/${solution_id}&${indicator_mark}&${indicator_name}`,
		method: 'get',
	})
}

// 更新指标
export function updateIndicators(solution_id: number, data: any) {
	return request({
		url: modulePrefix + `/${solution_id}`,
		method: 'post',
		data: data,
	})
}

/* 方案比选 */
export function compare(data: Array<number>) {
	return request({
		url: modulePrefix + `/compare`,
		method: 'post',
		data: data,
	})
}
export function importIndicator(solutionId: number, data: object){
	return request({
		url: modulePrefix + `/import/${solutionId}`,
		method: "post",
		data: data,
		headers: { 'Content-Type': 'multipart/form-data;charset=UTF-8' },
	});
};
export default {
	solutionIndicators,
	updateIndicators,
	addIndicator,
	compare,
	importIndicator
}
